package api

import (
	"github.com/gin-gonic/gin"
	"yxs-mall/common/models"
)

type Api struct {
	Errors error
}

// CurrentUser 获取当前用户
func (e *Api) CurrentUser(c *gin.Context) (loginUser models.CurrentUser, exist bool) {
	if user, exists := c.Get("currentUser"); exists {
		return user.(models.CurrentUser), true
	}
	return models.CurrentUser{}, false
}
